#include <stdio.h>
#define LEN 512

char stack[LEN];
int top = 0;

int is_empty(void)
{
     return (top == 0);
}

int is_full(void)
{
     return (top == LEN);
}

void push(char c)
{
    if (!is_full())
        stack[top++] = c;
    else
        --top;
    return;
}

char pop(void)
{
    if (top--)
        return stack[top];
    else
        return EOF;
}

int main(void)
{
    push('a'); push('b'); push('c'); push('d');
    while (!is_empty())
        putchar(pop());
    putchar('\n');
    return 0;
}

